package com.smartwebee.android.blespp.hospital.adapter;

import android.content.Context;
import android.databinding.DataBindingUtil;
import android.view.View;
import android.view.ViewGroup;

import com.smartwebee.android.blespp.R;
import com.smartwebee.android.blespp.bean.MsgBean;
import com.smartwebee.android.blespp.databinding.MsgItemBinding;
import com.smartwebee.android.blespp.hospital.HospitalBaseAdapter;

import java.util.List;

/**
 * Created by steward on 2018/7/31.
 */

public class MsgAdapter extends HospitalBaseAdapter<MsgBean> {

    public MsgAdapter(Context context, List<MsgBean> datas) {
        super(context, datas);
    }

    @Override
    protected View initView(int position, View convertView, ViewGroup parent) {
        MsgItemBinding binding = null;
        if (convertView == null) {
            binding = DataBindingUtil.inflate(inflater, R.layout.msg_item, parent, false);
            convertView = binding.getRoot();
            convertView.setTag(binding);
        } else {
            binding = (MsgItemBinding) convertView.getTag();
        }
        binding.tvTitle.setText(getItem(position).getTitle());
        binding.tvContent.setText(getItem(position).getContent());
        binding.tvTime.setText(getItem(position).getTime());
        return convertView;
    }
}
